<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/cloudiary.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Cloudiary</title>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->
<script type="text/javascript" src="Js/jquery.js"></script>
<script type="text/javascript" src="Js/slider.js"></script>
<!-- InstanceEndEditable -->
<link href="CSS/css.css" rel="stylesheet" type="text/css" />
</head>
<?php
include('userlock.php');

if($_SERVER["REQUEST_METHOD"] == "POST")
{
	
	if(!empty($_FILES['profile_pic']['tmp_name']))
	{
		$photo = addslashes(file_get_contents($_FILES['profile_pic']['tmp_name']));
		$photo_size = getimagesize($_FILES['profile_pic']['tmp_name']);
		
		if($photo_size==FALSE)
		{
			echo "That's not an image.";
		}
		else
		{
			mysql_query("UPDATE user SET user_picture = '$photo' WHERE user_email='$login_session'");
		}
	}
	
	if($_POST['Username'] && $_POST['AccountRestriction'])
	{
		
		$myusername=addslashes($_POST['Username']);			
		$accountrestriction=addslashes($_POST['AccountRestriction']);
		$mycountry=addslashes($_POST['Country']);
		$sql1="UPDATE user SET user_name='$myusername', user_account_restriction='$accountrestriction', user_country='$mycountry' WHERE user_email='$login_session'";

		mysql_query($sql1);
	}
}

$sql = "SELECT * FROM user Where user_email = '$login_session'";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);

?>
<body>
<div id="container">
<div id="wrapper">

<div id="header">
<!-- InstanceBeginEditable name="header" -->
<div class="welcome">
<?php include('welcomeuser.php'); ?>
</div>
<!-- InstanceEndEditable -->

<img src="Assets/cloud diary low-01(trans).png" alt="CloudDiary" width="75" height="45" style="padding:5px 10px;" /> <br />
</div>

<div id="main">
<!-- InstanceBeginEditable name="main" -->
<ul class="dropdown">
<li><a href="Home.php" class="linkStraight">Home &nbsp; &nbsp;</a></li>
<li><a href="#" class="linkDown" id="classification">Classifications &nbsp; &nbsp;</a>
	<ul class="sub_menu" id="menu1">
    <li> <a href="PublicClassification.php"> Public &nbsp; </a> </li>
    <li> <a href="FriendClassification.php"> Friend &nbsp; </a> </li>
    </ul>
</li>
<li><a href="#" class="linkDown" id="friends">Friends &nbsp; &nbsp;</a>
	<ul class="sub_menu" id="menu2">
    <li> <a href="Friends.php"> Search Friends &nbsp; </a> </li>
    <li> <a href="CurrentFriends.php"> Current Friends &nbsp; </a> </li>
    <li> <a href="Send.php"> Sending Request &nbsp; </a> </li>
    <li> <a href="Receive.php"> Pending Request &nbsp; </a> </li>
    </ul>
</li>
<li><a href="#" class="linkDown" id="posts">Posts &nbsp; &nbsp;</a>
	<ul class="sub_menu" id="menu3">
    <li> <a href="NewPost.php"> New Post &nbsp; </a> </li>
    <li> <a href="ViewPosts.php">  View All Posts &nbsp; </a> </li>
    </ul>
</li>
<li><a href="Privacy.php" class="linkStraight">Privacy Settings &nbsp; &nbsp;</a></li>
</ul>

<div id="content">
	<form name="particulars" method="post" enctype="multipart/form-data">
	
    <table border="0" width="95%">
    <tr>
    <td colspan="4">&nbsp;  </td>
    </tr>
    <tr>
    <td rowspan="4" width="50">&nbsp;  </td>
    <td width="250" rowspan="3" align="center"> <img src="display_photo.php?id=<?php echo $row['user_email']; ?>" alt="Profile Picture" width="250px" height="270px" align="top" style="border:solid 1px #69F; padding:2px;"/> <br /> <br />
		<input type ="file" name="profile_pic"></td>
    <td  rowspan="3" width="50" style="border-right:solid 1px #69F">&nbsp; </td>
    
    <td> &nbsp; Particulars </td>
    </tr>
    <tr>
	<td>
    
    <table border="0" width="500">
	<tr>
    <td width="150"> &nbsp; Username </td>
    <td width="350"> : <input type="text" name="Username" value="<?php echo $row["user_name"]; ?>" /></td>
    </tr>
    <tr>
    <td> &nbsp; Password </td>
    <td> : <input type="password" name="Password" value="password" disabled="disabled"/> &nbsp;
    <a href="Password.php" style="text-decoration:none"> Edit </a> </td>
    </tr>
    <tr>
    <td> &nbsp; Country </td>
    <td> : <input type="text" name="Country" <?php if(empty($row['user_country'])) {echo "placeholder='Where do you live ?'";} else { echo "value='".$row['user_country']."'"; } ?>/> </td>
    </tr>
    <tr> <br />
    <td width="150" height="26"> &nbsp;Account Restriction </td>
    <td> : <select name="AccountRestriction" >
    <option <?php if (  $row['user_account_restriction'] == 'public' ): ?> selected="selected"<?php endif; ?> > public </option>
    <option <?php if (  $row['user_account_restriction'] == 'private' ): ?> selected="selected"<?php endif; ?> > private </option>
    </select> </td>
    </tr>
    </table>
    </td>
    </tr>
    <tr>
    <td colspan="4" align="right"> <input type="image" src="Assets/buttonUpdate.png" onClick="window.location.href=window.location.href"/> </td>
    </tr>
    </table></td>
    </tr>
    </table>
	</form>
	<!-- InstanceEndEditable -->
</div>

</div>
</div>

<div id="footer">
<p align="center"> &copy; &nbsp; 2012 CloudDiary </p>
</div>
</body>
<!-- InstanceEnd --></html>
